<?php

namespace youmbe\phpword\Style;

//namespace PhpOffice\PhpWord\Style;

use PhpOffice\Common\Text;
use PhpOffice\PhpWord\Exception\InvalidStyleException;
use PhpOffice\PhpWord\SimpleType\Jc;
use PhpOffice\PhpWord\SimpleType\TextAlignment;

/**
 * Paragraph style
 *
 * OOXML:
 * - General: alignment, outline level
 * - Indentation: left, right, firstline, hanging
 * - Spacing: before, after, line spacing
 * - Pagination: widow control, keep next, keep line, page break before
 * - Formatting exception: suppress line numbers, don't hyphenate
 * - Textbox options
 * - Tabs
 * - Shading
 * - Borders
 *
 * OpenOffice:
 * - Indents & spacing
 * - Alignment
 * - Text flow
 * - Outline & numbering
 * - Tabs
 * - Dropcaps
 * - Tabs
 * - Borders
 * - Background
 *
 * @see  http://www.schemacentral.com/sc/ooxml/t-w_CT_PPr.html
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class Paragraph extends \PhpOffice\PhpWord\Style\Paragraph {

    /**
     * 缩进 indentleft and indentright段落缩进值,单位为twips
     *  
     * 缩进indentFirstLine and indentFirstChars  首行缩进twips数
     *  
     * @var int          
     */
    private $_indentLeft;
    private $_indentRight;
    private $_indentFirstLine;
    private $_indentFirstLineChars;

    /**
     * 获取段落缩进值
     * @return type
     */
    public function getIndentLeft() {
        return $this->_indentLeft;
    }

    /**
     * 设置段落缩进值
     * @return type
     */
    public function setIndentLeft($pValue = null) {
        $this->_indentLeft = $pValue;
        return $this;
    }

    // 获取右缩进值 
    public function getIndentRight() {
        return $this->_indentRight;
    }

    // 设置右缩进值 
    public function setIndentRight($pValue = null) {
        $this->_indentRight = $pValue;
        return $this;
    }

    /**
     * 首行缩进相关方法
     * @return type
     */
    public function setIndentFirstLine($pValue = null) {
        $this->_indentFirstLine = $pValue;
        return $this;
    }

    /**
     * Get indentation
     *
     * @return int
     */
    public function getIndent() {
        return $this->getChildStyleValue($this->indentation, 'left');
    }

    /**
     * Set indentation
     *
     * @param int $value
     * @return self
     */
    public function setIndent($value = null) {
        return $this->setIndentation(array('left' => $value));
    }

    /**
     * 首行缩进相关方法
     * @return type
     */
    public function getIndentFirstLine() {
        return $this->_indentFirstLine;
    }

    /**
     * 首行缩进相关方法
     * @return type
     */
    public function setIndentFirstLineChars($pValue = null) {
        $this->_indentFirstLineChars = $pValue;
        return $this;
    }

    /**
     * 首行缩进相关方法
     * @return type
     */
    public function getIndentFirstLineChars() {
        return $this->_indentFirstLineChars;
    }

}
